using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class DepotSlot : MonoBehaviour
{
    public Image Icon;
    public TextMeshProUGUI Name;
    public TextMeshProUGUI Num;

    private ItemConfigData data;
    private int quantity;
    public void SetData(ItemConfigData itemData, int num)
    {
        data = itemData;
        quantity = num;

        Name.text = data.itemName;
        Num.text = quantity.ToString();

        switch(data.rarity)
        {
            case Rarity.unknown:
                Icon.color = Color.black;
                break;
            case Rarity.normal:
                Icon.color = Color.white;
                break;
            case Rarity.rare:
                Icon.color = new Color(0.35f, 0.85f, 1f);
                break;
            case Rarity.epic:
                Icon.color = new Color(0.35f, 0.5f, 1f);
                break;
            case Rarity.legendary:
                Icon.color = new Color(1f, 0.85f, 0.35f);
                break;
        }
    }

    public void ShowDetail()
    {
        DepotManager.Instance.ShowDepotDetail(data, quantity);
    }
}
